約 2,550,268 件
https://w.atwiki.jp/azounoman/pages/51.html
2140 Herd Sums 問題 http //acm.pku.edu.cn/JudgeOnline/problem?id=2140 解答例 import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int cnt = 0; for(int m=1;m =n;m++){ if(n (m*(m+1))/2) break; if(m%2==1){ if(n%m==0) cnt++; } else{ if((2*n)%m==0 ((2*n)/m)%2==1) cnt++; } } System.out.println(cnt); } }
https://w.atwiki.jp/testkdltest/pages/3397.html
lv116103921 23 21~ 01 sm3604990 【KAITO】アナザー:ワールドイズマイン / awk 02 sm19340232 【女装】z7def式KAITOで『え?あぁ、そう。』【KAITOカバー】 / 03 sm17165924 チビカイトとテッドでまっくら森の歌カバー / 04 sm19160630 【DIVA- f】 ボカロ6人で 「アメイジング・グレイス」 【編集PV】 / 斜め上P 05 sm17469576 【KAITO・鏡音レン】モウモクポエム【カバー】 / 連投P 06 sm14542283 【KAITO】Real pressure【オリジナル】 / いわしP 07 sm19316693 【KAITO】「Air...(piano arrange Ver.)」を歌ってもらった【カバー】 / ← part1272 | part1273 | part1274 → 曲順・抜け等、ミスありましたら修正お願いします。 編集方法がよくわからないようでしたら、以下に記入ください。気付き次第修正します。 名前 コメント
https://w.atwiki.jp/azounoman/pages/10.html
1131 Octal Fractions 問題 http //acm.pku.edu.cn/JudgeOnline/problem?id=1131 解答例 import java.util.*; import java.math.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String line = sc.nextLine(); BigInteger input = new BigInteger(line.substring(2),8); BigDecimal d = new BigDecimal(input); for(int i=0;i line.length()-2;i++){ d = d.divide(new BigDecimal(8)); } System.out.println(line + " [8] = " + d + " [10]"); } } }
https://w.atwiki.jp/azounoman/pages/59.html
2505 A multiplication game 問題 http //acm.pku.edu.cn/JudgeOnline/problem?id=2505 解答例 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ long n = sc.nextLong(); int ans = solve(n); if(ans==1){ System.out.println("Stan wins."); } else{ System.out.println("Ollie wins."); } } } private static int solve(long n){ if(n==1) return 0; long m = (long)Math.ceil(n/9.0); if(m==1) return 1; long l = (long)Math.ceil(m/2.0); return solve(l); } }
https://w.atwiki.jp/azounoman/pages/54.html
2144 Leaky Cryptography 問題 http //acm.pku.edu.cn/JudgeOnline/problem?id=2144 解答例 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i=0;i n;i++){ int[] a = new int[9]; for(int j=0;j 9;j++){ long tmp = sc.nextLong(16); if(tmp Integer.MAX_VALUE) tmp -= (long)1 32; a[j] = (int)tmp; } int key = 0; for(int j=0;j 32;j++){ int[] b = new int[9]; for(int k=0;k 9;k++){ b[k] = a[k] ^ key; } int b07sum = 0; for(int k=0;k 8;k++) b07sum += b[k]; int mask = (1 j); if((b07sum mask)!=(b[8] mask)) key += (1 j); } System.out.println(Integer.toHexString(key)); } } }
https://w.atwiki.jp/azounoman/pages/6.html
1125 Stockbroker Grapevine 問題 http //acm.pku.edu.cn/JudgeOnline/problem?id=1125 解答例 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true){ int n = sc.nextInt(); if(n==0) break; int[][] dist = new int[n][n]; for(int i=0;i n;i++){ for(int j=0;j n;j++){ if(i==j) dist[i][j] = 0; else dist[i][j] = 65536; } } for(int i=0;i n;i++){ int m=sc.nextInt(); for(int j=0;j m;j++){ int p = sc.nextInt()-1; int t = sc.nextInt(); dist[i][p] = t; } } int[][] a = new int[n][n]; for(int i=0;i n;i++){ for(int j=0;j n;j++){ a[i][j] = dist[i][j]; } } for(int k=0;k n;k++){ for(int i=0;i n;i++){ for(int j=0;j n;j++){ if(a[i][j] a[i][k]+a[k][j]){ a[i][j] = a[i][k] + a[k][j]; } } } } int retp = -1; int rett = 65536; for(int i=0;i n;i++){ int max = 0; for(int j=0;j n;j++){ if(max a[i][j]) max = a[i][j]; } if(max rett){ retp = i; rett = max; } } if(retp==-1){ System.out.println("disjoint"); } else{ System.out.println((retp+1)+" "+rett); } } } }
https://w.atwiki.jp/azounoman/pages/31.html
1917 Automatic Poetry 問題 http //acm.pku.edu.cn/JudgeOnline/problem?id=1917 解答方針 Javaの正規表現クラス Pattern を利用して文字列の構成要素を抽出する. 解答例 import java.util.*; import java.util.regex.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); for(int i=0;i n;i++){ String line1 = sc.nextLine(); Pattern pattern; pattern = Pattern.compile(" | "); String[] strs = pattern.split(line1,-1); System.out.print (strs[0]+strs[1]+strs[2]+strs[3]+strs[4]); System.out.println(); String line2 = sc.nextLine(); line2 = line2.substring(0,line2.length()-3); System.out.print (line2+strs[3]+strs[2]+strs[1]+strs[4]); System.out.println(); } } }
https://w.atwiki.jp/azounoman/pages/11.html
1406 A Starship Hakodate-maru 問題 http //acm.pku.edu.cn/JudgeOnline/problem?id=1406 解答例 import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); while(true){ int f = sc.nextInt(); if(f==0) break; int c = cbrt(f); int c1 = c; int c2 = 0; int max = csum(c1,c2); while(c1 =0){ if(csum(c1,c2+1) =f){ c2++; if(max csum(c1,c2)){ max=csum(c1,c2); } } else{ c1--; } } System.out.println(max); } } private static int cbrt(int f) { int root=0; root=0; while(root*root*root =f) root++; root--; return root; } private static int cont1(int n){ return n*n*n; } private static int cont2(int n){ return n*(n+1)*(n+2)/6; } private static int csum(int n1,int n2){ return cont1(n1)+cont2(n2); } }
https://w.atwiki.jp/azounoman/pages/45.html
2046 Gap 問題 http //acm.pku.edu.cn/JudgeOnline/problem?id=2046 解答方針 BFS.ただし同じ状態は探索しないように,一度探索した状態はHashSetに登録するようにして,登録済みの状態に達したらその時点で枝刈りするようにする. PKUではメモリ制限が厳しいので,byte型を利用するなどしてメモリ使用量をおさえている. 解答例 import java.util.*; class State{ byte table[][]; int turn; public State(byte card[][]){ int i,j,sx,sy; table = new byte[4][8]; for(i=0;i 4;i++) table[i][0] = (byte)(10*(i+1)+1); for(i=0;i 4;i++){ for(j=1;j 8;j++){ table[i][j] = card[i][j-1]; } } for(i=0;i 4;i++){ for(j=1;j 8;j++){ if(table[i][j]==11 || table[i][j]==21 || table[i][j]==31 || table[i][j]==41) table[i][j] = 0; } } turn = 0; } // copy constructor public State(State t){ table = new byte[4][8]; int i,j; for(i=0;i 4;i++){ for(j=0;j 8;j++){ table[i][j] = t.table[i][j]; } } turn = t.turn; } public boolean canFillGap(int x,int y){ if(table[x][y] != 0) return false; else if(table[x][y-1] == 0 || (table[x][y-1])%10 == 7) return false; else return true; } public void fillGap(int x,int y){ int s,sx,sy,i,j; sx = sy = -1; s = table[x][y-1] + 1; for(i=0;i 4;i++){ for(j=0;j 8;j++){ if(table[i][j] == s){ sx = i; sy = j; } } } table[x][y] = table[sx][sy]; table[sx][sy] = 0; turn++; } boolean isEnd(){ int i,j; for(i=0;i 4;i++){ for(j=0;j 7;j++){ if(table[i][j]!=(10*(i+1)+(j+1))) return false; } if (table[i][7]!=0) return false; } return true; } public boolean equals(Object o){ State s = (State)o; int i,j; for(i=0;i 4;i++){ for(j=1;j 8;j++){ if(table[i][j]!=s.table[i][j]) return false; } } return true; } public int hashCode(){ int value = 0; int i,j; for(i=0;i 4;i++){ for(j=1;j 8;j++){ value+=table[i][j]; value*=2; } } return value; } } class Solver{ State table; Solver(State t){ table = new State(t); } int solve(){ Queue State q = new LinkedList State (); HashSet State h = new HashSet State (); //prepare for BFS boolean end = false; int ans = Integer.MAX_VALUE; int i,j; State init = new State(table); q.offer(init); h.add(init); if(init.isEnd()) return 0; //BFS while(!q.isEmpty() !end){ State s = q.poll(); for(i=0;i 4;i++){ for(j=1;j 8;j++){ if(s.canFillGap(i,j)){ State temp = new State(s); temp.fillGap(i,j); // find answer if(temp.isEnd()){ end = true; ans = temp.turn; } // if unsearched state, add it to queue and hash else if(!h.contains(temp)){ q.offer(temp); h.add(temp); } } } } } if(ans==Integer.MAX_VALUE) ans = -1; return ans; } } public class Main{ public static void main(String args[]){ int n; byte card[][] = new byte [4][7]; State tb; Solver sol; int i,j,k; Scanner sc = new Scanner(System.in); n = sc.nextInt(); for(i=0;i n;i++){ for(j=0;j 4;j++){ for(k=0;k 7;k++){ card[j][k] = sc.nextByte(); } } tb = new State(card); sol = new Solver(tb); System.out.println(sol.solve()); } } }
https://w.atwiki.jp/futabayukkuriss/pages/2659.html
「ふたば系ゆっくりいじめ 1273 ゆくドナルド3/コメントログ」 ゆうかにゃんポテトは買いだな!ゆっくりしないで買いに行くよ -- 2010-05-28 20 50 33 ゆうかにゃんポテトほぴぃ; ソフトクリームはちょっと食いたくないなw<ぺにぺにの部分から出てくる -- 2011-01-15 18 05 36 ゆうかにゃんポテト買うためなら借金してもいい!! -- 2011-10-08 02 36 37 ベーコンまりちゃバーガーウマソ -- 2011-10-08 15 55 05 赤ゆファイブ注文したら煩そうww(まぁ、注文するけどwww ···れてぃ白岩さん、どぼじでぇ? -- 2018-01-15 22 18 46